﻿'*******************************************************************
' Program: Data Center Visio Rack Tool
' Author: Albert E Edlund
' Date:
'
' Purpose: load data for drawings
'
'
'*******************************************************************

Imports Microsoft.Practices.EnterpriseLibrary.Common
Imports Microsoft.Practices.EnterpriseLibrary.Data
Imports Microsoft.Practices.EnterpriseLibrary.ExceptionHandling
Imports Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging


Public Class dlgDataSummary




    Public Sub ListDataTables(ByVal dsLoaded As System.Data.DataSet)

        Try

            Me.lvwDataSummary.View = View.Details
            Me.lvwDataSummary.Items.Clear()
            Me.lvwDataSummary.Clear()
            lvwDataSummary.Columns.Add("TableName", 100)
            lvwDataSummary.Columns.Add("RecordCt")

            Dim itemNew As ListViewItem
            Dim strTableName As String

            Dim tblData As System.Data.DataTable
            For Each tblData In dsLoaded.Tables
                strTableName = tblData.TableName
                ' use the table name as the key
                itemNew = New ListViewItem(strTableName)
                itemNew.Name = strTableName
                itemNew.SubItems.Add(tblData.Rows.Count)
                lvwDataSummary.Items.Add(itemNew)
            Next tblData

            lvwDataSummary.Refresh()

        Catch ex As Exception
            Dim rethrow As Boolean = ExceptionPolicy.HandleException(ex, "Log Only Policy")
            If (rethrow) Then
                Throw
            End If
        End Try

    End Sub


    Private Sub btnExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExit.Click
        Me.Close()
    End Sub

End Class